package com.mobdev.notepadgdocs;

import android.os.Bundle;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.PreferenceActivity;

public class PreferencesActivity extends PreferenceActivity {

	OnPreferenceChangeListener commonListener = new OnPreferenceChangeListener() {

		@Override
		public boolean onPreferenceChange(Preference preference, Object newValue) {
			setSummary(preference, newValue);
			return true;
		}
	};

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        // Load the preferences from an XML resource
        addPreferencesFromResource(R.xml.preferences);

    }

    protected void setSummary(Preference preference, Object newValue) {
    	if(preference != null && newValue != null) {
    		if(newValue instanceof String && !((String) newValue).trim().equals("") ) {
    			preference.setSummary( "(" + newValue + ")");
    		}
		}

    }
}
